// locutor
// (c) 2009, Normen Müller, normen.mueller@gmail.com  
// $Id: R.scala 28 2009-11-10 15:01:20Z normen.mueller $
package locutor.model

import java.io.File

import locutor.parsing.model.rs.RuleSystemParser

/** Companion to <code>RuleSystem</code> class.
 * 
 * @author <a href="mailto:normen.mueller@googlemail.com">Normen M&#xFC;ller</a>
 * @version 0.0.3 */
object RuleSystem {

  def parse(description: File): RuleSystem = RuleSystemParser.parse(description) 
  
}

/** A rule system.
 * 
 * @author <a href="mailto:normen.mueller@googlemail.com">Normen M&#xFC;ller</a>
 * @version 0.0.3 */
class RuleSystem private [locutor] (val name: String, val statements: List[String]) {
  
  def ++(rs: Option[List[RuleSystem]]) = rs match {
    case Some(rs) => new RuleSystem(name, statements ::: (rs flatMap (_.statements)))
    case None     => this
  }
  
}